/*
 * Copyright [2022] [https://www.xiaonuo.vip]
 *
 * Snowy采用APACHE LICENSE 2.0开源协议，您在使用过程中，需要注意以下几点：
 *
 * 1.请不要删除和修改根目录下的LICENSE文件。
 * 2.请不要删除和修改Snowy源码头部的版权声明。
 * 3.本项目代码可免费商业使用，商业使用请保留源码和相关描述文件的项目出处，作者声明等。
 * 4.分发源码时候，请注明软件出处 https://www.xiaonuo.vip
 * 5.不可二次分发开源参与同类竞品，如有想法可联系团队xiaonuobase@qq.com商议合作。
 * 6.若您的项目无法满足以上几点，需要更多功能代码，获取Snowy商业授权许可，请在官网购买授权，地址为 https://www.xiaonuo.vip
 */
package cn.lixunims.ims.modular.bill.entity;

import cn.hutool.json.JSONObject;
import cn.lixunims.ims.modular.basics.entity.ImsCustomer;
import cn.lixunims.ims.modular.basics.entity.ImsSupplier;
import cn.lixunims.ims.modular.basics.entity.ImsWarehouse;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;

/**
 * 出入库单据头实体
 *
 * @author YouDong
 * @date  2024/09/19 14:28
 **/
@Getter
@Setter
@TableName("ims_bill_header")
public class ImsBillHeader {

    /** 主键ID */
    @TableId
    @Schema(description = "主键ID")
    @ExcelIgnore
    private String billId;

    /** 单据编号 */
    @Schema(description = "单据编号")
    @NotBlank(message = "单据编号不能为空")
    @ExcelProperty(value = "单据编号")
    private String billOrderNo;

    /** 原始单号 */
    @Schema(description = "原始单号")
    @ExcelProperty(value = "原始单号")
    private String oldOrderNo;

    /** 类型 */
    @Schema(description = "类型")
    @NotBlank(message = "单据类型不能为空")
    @ExcelProperty(value = "类型")
    private String billType;

    /** 状态 */
    @Schema(description = "状态")
    @ExcelProperty(value = "状态")
    private String billStatus;

    /** 单据日期 */
    @Schema(description = "单据日期")
    @NotBlank(message = "单据日期不能为空")
    @ExcelProperty(value = "单据日期")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
    private LocalDate billDate;

    /** 开单日期 */
    @Schema(description = "开单日期")
    @NotBlank(message = "开单日期不能为空")
    @ExcelProperty(value = "开单日期")
    private Date deliveryDate;

    /** 发票类型 */
    @Schema(description = "发票类型")
    @ExcelProperty(value = "发票类型")
    private String invoiceType;

    /** 入库仓库 */
    @Schema(description = "入库仓库")
    @ExcelIgnore
    private String warehousingIds;

    /** 出库仓库 */
    @Schema(description = "出库仓库")
    @ExcelIgnore
    private String retrievalIds;

    /** 经手人 */
    @Schema(description = "经手人")
    @ExcelProperty(value = "经手人")
    private String userIds;

    /** 供应商 */
    @Schema(description = "供应商")
    @ExcelProperty(value = "供应商")
    private String supplierIds;

    /** 客户 */
    @Schema(description = "客户")
    @ExcelProperty(value = "客户")
    private String customerIds;

    /** 备注 */
    @Schema(description = "备注")
    @ExcelProperty(value = "备注")
    private String orderRemark;

    /** 定金 */
    @Schema(description = "定金")
    @ExcelProperty(value = "定金")
    private BigDecimal deposit;

    /** 总金额 */
    @Schema(description = "总金额")
    @ExcelProperty(value = "总金额")
    private BigDecimal orderAmount;

    /** 总数量 */
    @Schema(description = "总数量")
    @ExcelProperty(value = "总数量")
    private Long orderNum;

    /** 创建者 */
    @Schema(description = "创建者")
    @ExcelIgnore
    private String createUser;

    /** 创建时间 */
    @Schema(description = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    @ExcelIgnore
    private Date createTime;

    /** 更新者 */
    @Schema(description = "更新者")
    @ExcelIgnore
    private String updateUser;

    /** 更新时间 */
    @Schema(description = "更新时间")
    @TableField(fill = FieldFill.UPDATE)
    @ExcelIgnore
    private Date updateTime;

    @TableField(exist = false)
    @ExcelIgnore
    private ImsSupplier supplier;
    @TableField(exist = false)
    @ExcelIgnore
    private ImsCustomer customer;
    @TableField(exist = false)
    @ExcelIgnore
    private ImsWarehouse warehouse;

    @TableField(exist = false)
    @ExcelIgnore
    private JSONObject user;
    // 明细
    @TableField(exist = false)
    @ExcelIgnore
    private List<ImsBillDetail> imsBillDetails;



    @TableField(exist = false)
    @ExcelIgnore
    private String supplierName;
    @TableField(exist = false)
    @ExcelIgnore
    private String warehouseName;
    @TableField(exist = false)
    @ExcelIgnore
    private String customerName;
    @TableField(exist = false)
    @ExcelIgnore
    private String userName;
    @TableField(exist = false)
    @ExcelIgnore
    private String byOrder;

}
